function f_plotCM(CM,maxV)
CM = CM/sum(CM(1,:))*100;


[r c]=size(CM);
for ix = 1:r
    for iy = r:-1:1
        s = area([ix-1 ix],[iy iy],iy-1);hold on;
        covl = CM(ix,iy)./maxV;
        if covl>1
            covl=1;
        end
        if covl<0
            covl=0;
        end
        set(s,'facecolor',[1 1 1]-covl.*[1 1 1]);
    end
end
hold on; plot([0 r],[0 r],'k');
axis([0 r 0 r]);
axis square
PC = round(sum(diag(CM))./sum(sum(CM))*100);
title(['PC = ' num2str(PC) '%'],'fontsize',11)
g = colormap(gray);
colormap(flipud(g));
finger_names = {'Thumb';'Index';'Middle';'Ring';'Pinky'};
xticks([0.5 1.5 2.5 3.5 4.5]);
xticklabels(finger_names);
xtickangle(45);
yticks([0.5 1.5 2.5 3.5 4.5]);
yticklabels(finger_names);
xlabel('True Fingers','fontsize',11)
ylabel('Classified Fingers','fontsize',11)
colorbar
caxis([0 maxV]);
